package controllers

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"fmt"
)

func Auth() gin.HandlerFunc {
	return func(c *gin.Context) {
		user := GetUser(c)
		fmt.Println(user)
		if user == nil {
			c.Redirect(http.StatusMovedPermanently, "/login")
			return;
		}

		c.Next()
	}
}
